using MediatR;
using SmartTracking.ErrorCode;

namespace BaseData.ReadApi.Appcontext.Command.EweHistoryRecord_Files
{
    /// <summary>
    /// 获取种母历史记录分页列表命令
    /// </summary>
    public class GetEweHistoryRecordListCommand : IRequest<ApiResult<ApiPaging<EweHistoryRecordDto>>>
    {
        /// <summary>
        /// 页码，默认为1
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 每页记录数，默认为10
        /// </summary>
        public int PageSize { get; set; } = 10;

        /// <summary>
        /// 验证参数有效性
        /// </summary>
        /// <param name="errorMessage">错误信息</param>
        /// <returns>验证结果</returns>
        public bool Validate(out string errorMessage)
        {
            errorMessage = string.Empty;

            if (PageIndex < 1)
            {
                errorMessage = "页码必须大于0";
                return false;
            }

            if (PageSize < 1 || PageSize > 100)
            {
                errorMessage = "每页记录数必须在1-100之间";
                return false;
            }

            return true;
        }
    }

    /// <summary>
    /// 种母历史记录数据传输对象
    /// </summary>
    public class EweHistoryRecordDto
    {
        /// <summary>
        /// 历史记录ID
        /// </summary>
        public int HistoryId { get; set; }

        /// <summary>
        /// 种母耳号
        /// </summary>
        public int EweId { get; set; }

        /// <summary>
        /// 配种日期
        /// </summary>
        public DateTime MatingDate { get; set; }

        /// <summary>
        /// 种公耳号
        /// </summary>
        public int? RamId { get; set; }

        /// <summary>
        /// 妊检日期
        /// </summary>
        public DateTime? PregnancyCheckDate { get; set; }

        /// <summary>
        /// 妊检结果
        /// </summary>
        public string? PregnancyResult { get; set; }

        /// <summary>
        /// 分娩日期
        /// </summary>
        public DateTime? DeliveryDate { get; set; }

        /// <summary>
        /// 健羔数
        /// </summary>
        public int? HealthyLambCount { get; set; }

        /// <summary>
        /// 健羔总重
        /// </summary>
        public decimal? HealthyLambTotalWeight { get; set; }

        /// <summary>
        /// 弱羔数
        /// </summary>
        public int? WeakLambCount { get; set; }

        /// <summary>
        /// 畸形数
        /// </summary>
        public int? DeformedCount { get; set; }

        /// <summary>
        /// 死胎数
        /// </summary>
        public int? StillbirthCount { get; set; }

        /// <summary>
        /// 木乃伊数
        /// </summary>
        public int? MummyCount { get; set; }

        /// <summary>
        /// 畸胎数
        /// </summary>
        public int? AbnormalCount { get; set; }

        /// <summary>
        /// 当前胎次
        /// </summary>
        public int CurrentParity { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string? Note { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
    }
}